package com.example.administrator.accessabilityservicestudy;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

/**
 * Created by Administrator on 2017/10/18 0018.
 */
public class MyAdapter extends BaseAdapter {

    public Context mContext;
    public List<DataBean> datas;
    public MyAdapter(){};
    public MyAdapter(Context mContext, List<DataBean> datas) {
        this.mContext = mContext;
        this.datas = datas;

    }

    @Override
    public int getCount() {
        return datas.size();
    }

    @Override
    public Object getItem(int i) {
        return datas.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }


    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view = LayoutInflater.from(mContext).inflate(R.layout.item_lv,null);
        TextView tv_content = (TextView) view.findViewById(R.id.tv_content);
        DataBean dataBean = datas.get(i);
        tv_content.setText(dataBean.getContent());
        return view;
    }
}
